<template>
  <div id="app">
    <img alt="Vue logo" src="./assets/logo.png">
    <button @click="one">第一种方式</button>
    <button @click="two">第二种方式</button>
    <HelloWorld v-if="tab === 1" />
    <ToTop v-else ToTop/>
  </div>
</template>

<script>
import HelloWorld from './components/HelloWorld.vue'
import ToTop from './components/ToTop.vue'

export default {
  name: 'App',
  components: {
    HelloWorld,
    ToTop
  },
  data(){
    return {
      tab: 1
    }
  },
  methods: {
    one(){
      this.tab = 1
    },
    two(){
      this.tab = 2
    }
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
